package com.JobFind.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Proxy;

import com.JobFind.DTO.CompanyDTO;
import com.JobFind.DTO.CompanyShowDTO;
import com.JobFind.DTO.CompanySimplyDTO;


/**
 * TbCompany entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="tb_company",catalog="jobfind")
@Proxy(lazy = false)
public class TbCompany  implements java.io.Serializable {


	private static final long serialVersionUID = 1L;
	private Integer companyId;
    private String companyName;
    private String companyLoginName;
    private String companyPwd;
    private String companyPhone;
    private String companyEmail;
    private String companyAdmin;
    private String adminCard;
    private String companyLogo;
    private Integer companyStatus;
    private String companyRemarks;
    private Set<TbRecruitment> tbRecruitments = new HashSet<TbRecruitment>(0);


    // Constructors

    /** default constructor */
    public TbCompany() {
    }

	/** minimal constructor */
    public TbCompany(String companyLoginName, String companyPwd) {
        this.companyLoginName = companyLoginName;
        this.companyPwd = companyPwd;
    }
    
    /** full constructor */
    public TbCompany(String companyName, String companyLoginName, String companyPwd,String companyPhone, String companyEmail, String companyAdmin, String adminCard, String companyLogo, Integer companyStatus, String companyRemarks, Set<TbRecruitment> tbRecruitments) {
        this.companyName = companyName;
        this.companyLoginName = companyLoginName;
        this.companyPwd = companyPwd;
        this.companyPhone = companyPhone;
        this.companyEmail = companyEmail;
        this.companyAdmin = companyAdmin;
        this.adminCard = adminCard;
        this.companyLogo = companyLogo;
        this.companyStatus = companyStatus;
        this.companyRemarks = companyRemarks;
        this.tbRecruitments = tbRecruitments;
    }

   
    // Property accessors
    @Id @GeneratedValue
    
    @Column(name="CompanyId", unique=true, nullable=false)

    public Integer getCompanyId() {
        return this.companyId;
    }
    
    public void setCompanyId(Integer companyId) {
        this.companyId = companyId;
    }
    
    @Column(name="CompanyName", length=20)

    public String getCompanyName() {
        return this.companyName;
    }
    
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    
    @Column(name="CompanyLoginName", nullable=false, length=20)

    public String getCompanyLoginName() {
        return this.companyLoginName;
    }
    
    public void setCompanyLoginName(String companyLoginName) {
        this.companyLoginName = companyLoginName;
    }
    
    @Column(name="CompanyPwd", nullable=false, length=20)

    public String getCompanyPwd() {
        return this.companyPwd;
    }
    
    public void setCompanyPwd(String companyPwd) {
        this.companyPwd = companyPwd;
    }
    
    @Column(name="CompanyPhone", length=20)

    public String getCompanyPhone() {
        return this.companyPhone;
    }
    
	public void setCompanyPhone(String companyPhone) {
        this.companyPhone = companyPhone;
    }
    
    @Column(name="CompanyEmail", length=20)

    public String getCompanyEmail() {
        return this.companyEmail;
    }
    
    public void setCompanyEmail(String companyEmail) {
        this.companyEmail = companyEmail;
    }
    
    @Column(name="CompanyAdmin", length=20)

    public String getCompanyAdmin() {
        return this.companyAdmin;
    }
    
    public void setCompanyAdmin(String companyAdmin) {
        this.companyAdmin = companyAdmin;
    }
    
    @Column(name="AdminCard", length=30)

    public String getAdminCard() {
        return this.adminCard;
    }
    
    public void setAdminCard(String adminCard) {
        this.adminCard = adminCard;
    }
    
    @Column(name="CompanyLogo", length=50)

    public String getCompanyLogo() {
        return this.companyLogo;
    }
    
    public void setCompanyLogo(String companyLogo) {
        this.companyLogo = companyLogo;
    }
    
    @Column(name="CompanyStatus")

    public Integer getCompanyStatus() {
        return this.companyStatus;
    }
    
    public void setCompanyStatus(Integer companyStatus) {
        this.companyStatus = companyStatus;
    }
    
    @Column(name="CompanyRemarks", length=2000)

    public String getCompanyRemarks() {
        return this.companyRemarks;
    }
    
    public void setCompanyRemarks(String companyRemarks) {
        this.companyRemarks = companyRemarks;
    }
    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="tbCompany")

    public Set<TbRecruitment> getTbRecruitments() {
        return this.tbRecruitments;
    }
    
    public void setTbRecruitments(Set<TbRecruitment> tbRecruitments) {
        this.tbRecruitments = tbRecruitments;
    }
    public CompanyDTO toDTO(){
    	CompanyDTO companyDTO = new CompanyDTO();
    	companyDTO.setAdminCard(this.getAdminCard());
    	companyDTO.setCompanyAdmin(this.getCompanyAdmin());
    	companyDTO.setCompanyEmail(this.getCompanyEmail());
    	companyDTO.setCompanyId(this.getCompanyId());
    	companyDTO.setCompanyLoginName(this.getCompanyLoginName());
    	companyDTO.setCompanyLogo(this.getCompanyLogo());
    	companyDTO.setCompanyName(this.getCompanyName());
    	companyDTO.setCompanyPhone(this.getCompanyPhone());
    	companyDTO.setCompanyPwd(this.getCompanyPwd());
    	companyDTO.setCompanyRemarks(this.getCompanyRemarks());
    	companyDTO.setCompanyStatus(this.getCompanyStatus());
    	return companyDTO;
    }
    
    public CompanySimplyDTO toSimplyDTO(){
    	CompanySimplyDTO companySimplyDTO = new CompanySimplyDTO();
    	companySimplyDTO.setCompanyAdmin(this.getCompanyAdmin());
    	companySimplyDTO.setCompanyEmail(this.getCompanyEmail());
    	companySimplyDTO.setCompanyId(this.getCompanyId());
    	companySimplyDTO.setCompanyLogo(this.getCompanyLogo());
    	companySimplyDTO.setCompanyName(this.getCompanyName());
    	companySimplyDTO.setCompanyPhone(this.getCompanyPhone());
    	companySimplyDTO.setCompanyRemarks(this.getCompanyRemarks());
    	return companySimplyDTO;
    }
    
    public CompanyShowDTO toShowDTO(){
    	CompanyShowDTO companyShowDTO = new CompanyShowDTO();
    	companyShowDTO.setCompanyId(this.getCompanyId());
    	companyShowDTO.setCompanyLoginName(this.getCompanyLoginName());
    	companyShowDTO.setCompanyName(this.getCompanyName());
    	return companyShowDTO;
    }
}